home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / !Interfaces / Universal Interfaces 2.0a1 / CIncludes / Dictionary.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-17  |  3.9 KB  |  126 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Dictionary.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a1.  ETO #15, MPW prerelease.  Sunday, July 17, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __DICTIONARY__
  18. #define __DICTIONARY__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifndef __FILES__
  27. #include <Files.h>
  28. #endif
  29. /*    #include <MixedMode.h>                                        */
  30. /*    #include <OSUtils.h>                                        */
  31.  
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35.  
  36. #if GENERATINGPOWERPC
  37. #pragma options align=mac68k
  38. #endif
  39.  
  40. #ifdef __CFM68K__
  41. #pragma lib_export on
  42. #endif
  43.  
  44.  
  45. enum {
  46. /* Dictionary data insertion modes */
  47.     kInsert                        = 0,                            /* Only insert the input entry if there is nothing in the dictionary that matches the key. */
  48.     kReplace                    = 1,                            /* Only replace the entries which match the key with the input entry. */
  49.     kInsertOrReplace            = 2                                /* Insert the entry if there is nothing in the dictionary which matches the key. 
  50.                            If there is already matched entries, replace the existing matched entries with the input entry. */
  51. };
  52.  
  53. /* This Was InsertMode */
  54. typedef short DictionaryDataInsertMode;
  55.  
  56.  
  57. enum {
  58. /* Key attribute constants */
  59.     kIsCaseSensitive            = 0x10,                            /* case sensitive = 16        */
  60.     kIsNotDiacriticalSensitive    = 0x20                            /* diac not sensitive = 32    */
  61. };
  62.  
  63. enum {
  64. /* Registered attribute type constants.    */
  65.     kNoun                        = -1,
  66.     kVerb                        = -2,
  67.     kAdjective                    = -3,
  68.     kAdverb                        = -4
  69. };
  70.  
  71. /* This Was AttributeType */
  72. typedef SInt8 DictionaryEntryAttribute;
  73.  
  74. /* Dictionary information record */
  75. struct DictionaryInformation {
  76.     FSSpec                            dictionaryFSSpec;
  77.     long                            numberOfRecords;
  78.     long                            currentGarbageSize;
  79.     ScriptCode                        script;
  80.     short                            maximumKeyLength;
  81.     SInt8                            keyAttributes;
  82.     SInt8                            filler;
  83. };
  84. typedef struct DictionaryInformation DictionaryInformation;
  85.  
  86. struct DictionaryAttributeTable {
  87.     UInt8                            datSize;
  88.     DictionaryEntryAttribute        datTable[1];
  89. };
  90. typedef struct DictionaryAttributeTable DictionaryAttributeTable;
  91.  
  92. typedef DictionaryAttributeTable *DictionaryAttributeTablePtr;
  93.  
  94. extern pascal OSErr InitializeDictionary(const FSSpec *theFsspecPtr, short maximumKeyLength, unsigned char keyAttributes, ScriptCode script)
  95.  THREEWORDINLINE(0x303C, 0x0500, 0xAA53);
  96. extern pascal OSErr OpenDictionary(const FSSpec *theFsspecPtr, char accessPermission, long *dictionaryReference)
  97.  THREEWORDINLINE(0x303C, 0x0501, 0xAA53);
  98. extern pascal OSErr CloseDictionary(long dictionaryReference)
  99.  THREEWORDINLINE(0x303C, 0x0202, 0xAA53);
  100. extern pascal OSErr InsertRecordToDictionary(long dictionaryReference, ConstStr255Param key, Handle recordDataHandle, DictionaryDataInsertMode whichMode)
  101.  THREEWORDINLINE(0x303C, 0x0703, 0xAA53);
  102. extern pascal OSErr DeleteRecordFromDictionary(long dictionaryReference, ConstStr255Param key)
  103.  THREEWORDINLINE(0x303C, 0x0404, 0xAA53);
  104. extern pascal OSErr FindRecordInDictionary(long dictionaryReference, ConstStr255Param key, DictionaryAttributeTablePtr requestedAttributeTablePointer, Handle recordDataHandle)
  105.  THREEWORDINLINE(0x303C, 0x0805, 0xAA53);
  106. extern pascal OSErr FindRecordByIndexInDictionary(long dictionaryReference, long recordIndex, DictionaryAttributeTablePtr requestedAttributeTablePointer, Str255 recordKey, Handle recordDataHandle)
  107.  THREEWORDINLINE(0x303C, 0x0A06, 0xAA53);
  108. extern pascal OSErr GetDictionaryInformation(long dictionaryReference, DictionaryInformation *theDictionaryInformation)
  109.  THREEWORDINLINE(0x303C, 0x0407, 0xAA53);
  110. extern pascal OSErr CompactDictionary(long dictionaryReference)
  111.  THREEWORDINLINE(0x303C, 0x0208, 0xAA53);
  112.  
  113. #ifdef __CFM68K__
  114. #pragma lib_export off
  115. #endif
  116.  
  117. #if GENERATINGPOWERPC
  118. #pragma options align=reset
  119. #endif
  120.  
  121. #ifdef __cplusplus
  122. }
  123. #endif
  124.  
  125. #endif /* __DICTIONARY__ */
  126.